<?php
	require("./include/common.php");
	$page=$page?$page:1;
	$sql="select * from log where 1 ";
	$sql.=$user?" and username like '%$user%' ":"";
	$sql.=$ip4?" and ip like '%$ip4%' ":"";
	$sql.=$time4?" and time>".(strtotime($time4)-3600*24)." and time<".(strtotime($time4)+3600*24)." ":"";
	$sql.=" order by time desc limit ".(($page-1)*30).",30";
	$q=$db->getlist($sql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Log manager</title>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
	color: #000000;
}
body {
	background-color: #FFFFFF;
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style></head>

<body>
<table width="100%" border="1" cellpadding="5" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
    <td><form id="form1" name="form1" method="get" action="">
    &nbsp;分类小导航 ： 用户名：<input name="user" type="text" id="user" size="20" maxlength="20" />IP：
    <input name="ip4" type="text" id="ip4" size="20" maxlength="20" />
    登录时间：
    <input name="time4" type="text" id="time4" size="20" maxlength="20" /> 
    <input name="dosubmit" type="submit" id="dosubmit" value="查看" />
    </form>
    </td>
  </tr>
</table>

<table width="100%" border="1" cellpadding="5" cellspacing="0" bordercolor="#CCCCCC">
  <tr>
    <td align="center" bgcolor="#f1f1f1">用户ID</td>
    <td align="center" bgcolor="#f1f1f1">用户名</td>
    <td align="center" bgcolor="#f1f1f1">密码</td>
    <td align="center" bgcolor="#f1f1f1">登录IP</td>
    <td align="center" bgcolor="#f1f1f1">登录时间</td>
  </tr>
  <?php foreach($q as $r){ ?>
  <tr>
    <td align="center"><?php echo $r["userid"]; ?></td>
    <td align="center"><?php echo $r["username"]; ?></td>
    <td align="center"><?php echo $r["pwd"]; ?></td>
    <td align="center"><?php echo $r["ip"]; ?></td>
    <td align="center"><?php echo date("Y-m-d H:i:s",$r["time"]); ?></td>
  </tr>
  <?php } ?>
  <tr>
    <td colspan="5" align="center"><?php
	$link="?user=$user&ip4=$ip4&time=$time";
	echo "<a href='$link'>首页</a> <a href='$link&page=".--$page."'>上一页</a><a href='$link&page=".++$page."'>下一页</a>";
	?></td>
  </tr>
</table>

</body>
</html>
